package com.dudo;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class About extends Activity implements OnClickListener {

	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	//start the activity from the last saved instance (if there was one)
        super.onCreate(savedInstanceState);
        
        //set the layout to use
        setContentView(R.layout.about_screen);
        
        //get the layout we set up in /res/layout/about_screen.xml
        LinearLayout aboutLayout = (LinearLayout)this.findViewById(R.id.about_contributors_layout);
        
        //get the resources we have available
        Resources resources = this.getResources();
        
        //grab the contributors list (contained in /res/values/strings.xml)
        String[] contributors = resources.getStringArray(R.array.contributors);
        
        //for each contributor
        for(String s : contributors) {
        	//create a textview (label/un-editable text box)
        	TextView text = new TextView(this);
        	
        	//set the text size within the textview
        	text.setTextSize(16);
        	
        	//add the current contributor to the textview
        	text.setText(s);
        	
        	//add the textview to the layout
        	aboutLayout.addView(text);
        }
        
        //get the home button we added in /res/layout/about_screen.xml
        Button homeButton = (Button)this.findViewById(R.id.about_home_button);
        
        //give it a listener
        homeButton.setOnClickListener(this);
    }

	@Override
	public void onClick(View arg0) {
		//create a new intent pointing to the home screen
		Intent intent = new Intent(this,Home.class);
		
		//start that activity
		this.startActivity(intent);
	}
	
}
